﻿/// Write a method that counts how many times given number appears in given array.
/// Write a test program to check if the method is working correctly.


using System;

namespace c_sh_II_lek_3
{
    class Zad4
    {
        static void Main()
        {
            int[] arr =  { 1, 3, 5, 2, 9, 7, 2, 2 };

            Console.WriteLine(MaxTimeOcuranceInArray(arr, 2));
        }

        public static int MaxTimeOcuranceInArray(int[] array, int number)
        {
            int count = 0;
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i] == number)
                {
                    count++;
                }
            }
            return count;
        }
    }
}
